from .models import Detail
from django import forms
from utils.bootstrap_modelForm import BootstrapModelForm



class DetailForm(BootstrapModelForm):
    content_detail = forms.CharField(widget=forms.Textarea,label="计划详情",required=False)
    class Meta:
        model = Detail
        exclude = ["create_date"]
        # widgets = {
        #     'content_title':forms.TextInput(attrs={"placeholder":"长度不大于10"})
        # }

    def clean_content_title(self):
        conent_title = self.cleaned_data['content_title']
        if len(conent_title)>5:
            raise forms.ValidationError("简要概括即可，这只是题目")
        return conent_title
        

